|
Data.Array.Parallel.Unlifted.Sequential |
|
|
|
|
Description |
(c) [2006..2007] Manuel M T Chakravarty & Roman Leshchinskiy
License : see librariesndpLICENSE
Maintainer : Roman Leshchinskiy rl@cse.unsw.edu.au
Stability : experimental
Portability : portable
Description ---------------------------------------------------------------
External interface to unlifted arrays.
Todo ----------------------------------------------------------------------
|
|
Synopsis |
|
class HS e => UA e where | | | data USegd | | nullU :: UA e => UArr e -> Bool | | emptyU :: UA e => UArr e | | singletonU :: UA e => e -> UArr e | | consU :: UA e => e -> UArr e -> UArr e | | unitsU :: Int -> UArr () | | replicateU :: UA e => Int -> e -> UArr e | | (!:) :: UA e => UArr e -> Int -> e | | (+:+) :: UA e => UArr e -> UArr e -> UArr e | | indexedU :: UA e => UArr e -> UArr (Int :*: e) | | repeatU :: UA e => Int -> UArr e -> UArr e | | extractU :: UA a => UArr a -> Int -> Int -> UArr a | | tailU :: UA e => UArr e -> UArr e | | takeU :: UA e => Int -> UArr e -> UArr e | | dropU :: UA e => Int -> UArr e -> UArr e | | splitAtU :: UA e => Int -> UArr e -> (UArr e, UArr e) | | permuteU :: UA e => UArr e -> UArr Int -> UArr e | | mbpermuteU :: (UA e, UA d) => (e -> d) -> UArr e -> UArr Int -> UArr d | | bpermuteU :: UA e => UArr e -> UArr Int -> UArr e | | bpermuteDftU :: UA e => Int -> (Int -> e) -> UArr (Int :*: e) -> UArr e | | reverseU :: UA e => UArr e -> UArr e | | updateU :: UA e => UArr e -> UArr (Int :*: e) -> UArr e | | mapU :: (UA e, UA e') => (e -> e') -> UArr e -> UArr e' | | zipWithU :: (UA a, UA b, UA c) => (a -> b -> c) -> UArr a -> UArr b -> UArr c | | zipWith3U :: (UA a, UA b, UA c, UA d) => (a -> b -> c -> d) -> UArr a -> UArr b -> UArr c -> UArr d | | filterU :: UA e => (e -> Bool) -> UArr e -> UArr e | | packU :: UA e => UArr e -> UArr Bool -> UArr e | | foldlU :: UA a => (b -> a -> b) -> b -> UArr a -> b | | foldl1U :: UA a => (a -> a -> a) -> UArr a -> a | | foldl1MaybeU :: UA a => (a -> a -> a) -> UArr a -> MaybeS a | | foldU :: UA a => (a -> a -> a) -> a -> UArr a -> a | | fold1U :: UA a => (a -> a -> a) -> UArr a -> a | | fold1MaybeU :: UA a => (a -> a -> a) -> UArr a -> MaybeS a | | scanlU :: (UA a, UA b) => (b -> a -> b) -> b -> UArr a -> UArr b | | scanl1U :: UA a => (a -> a -> a) -> UArr a -> UArr a | | scanU :: UA a => (a -> a -> a) -> a -> UArr a -> UArr a | | scan1U :: UA a => (a -> a -> a) -> UArr a -> UArr a | | scanResU :: UA a => (a -> a -> a) -> a -> UArr a -> UArr a :*: a | | mapAccumLU :: (UA a, UA b) => (c -> a -> c :*: b) -> c -> UArr a -> UArr b | | combineU :: UA a => UArr Bool -> UArr a -> UArr a -> UArr a | | combineSU :: UA a => UArr Bool -> USegd -> UArr a -> USegd -> UArr a -> UArr a | | elemU :: (Eq e, UA e) => e -> UArr e -> Bool | | notElemU :: (Eq e, UA e) => e -> UArr e -> Bool | | andU :: UArr Bool -> Bool | | orU :: UArr Bool -> Bool | | anyU :: UA e => (e -> Bool) -> UArr e -> Bool | | allU :: UA e => (e -> Bool) -> UArr e -> Bool | | sumU :: (Num e, UA e) => UArr e -> e | | productU :: (Num e, UA e) => UArr e -> e | | maximumU :: (Ord e, UA e) => UArr e -> e | | minimumU :: (Ord e, UA e) => UArr e -> e | | maximumByU :: UA e => (e -> e -> Ordering) -> UArr e -> e | | minimumByU :: UA e => (e -> e -> Ordering) -> UArr e -> e | | maximumIndexU :: (Ord e, UA e) => UArr e -> Int | | minimumIndexU :: (Ord e, UA e) => UArr e -> Int | | maximumIndexByU :: UA e => (e -> e -> Ordering) -> UArr e -> Int | | minimumIndexByU :: UA e => (e -> e -> Ordering) -> UArr e -> Int | | zipU :: (UA a, UA b) => UArr a -> UArr b -> UArr (a :*: b) | | zip3U :: (UA e1, UA e2, UA e3) => UArr e1 -> UArr e2 -> UArr e3 -> UArr ((e1 :*: e2) :*: e3) | | unzipU :: (UA a, UA b) => UArr (a :*: b) -> UArr a :*: UArr b | | unzip3U :: (UA e1, UA e2, UA e3) => UArr ((e1 :*: e2) :*: e3) -> (UArr e1 :*: UArr e2) :*: UArr e3 | | fstU :: (UA a, UA b) => UArr (a :*: b) -> UArr a | | sndU :: (UA a, UA b) => UArr (a :*: b) -> UArr b | | enumFromToU :: Int -> Int -> UArr Int | | enumFromThenToU :: Int -> Int -> Int -> UArr Int | | enumFromStepLenU :: Int -> Int -> Int -> UArr Int | | enumFromToEachU :: Int -> UArr (Int :*: Int) -> UArr Int | | enumFromStepLenEachU :: Int -> UArr ((Int :*: Int) :*: Int) -> UArr Int | | findU :: UA a => (a -> Bool) -> UArr a -> Maybe a | | findIndexU :: UA a => (a -> Bool) -> UArr a -> Maybe Int | | toU :: UA e => [e] -> UArr e | | fromU :: UA e => UArr e -> [e] | | randomU :: (UA a, Random a, RandomGen g) => Int -> g -> UArr a | | randomRU :: (UA a, Random a, RandomGen g) => Int -> (a, a) -> g -> UArr a | | class UA a => UIO a where | | | replicateSU :: UA a => USegd -> UArr a -> UArr a | | replicateRSU :: UA a => Int -> UArr a -> UArr a | | appendSU :: UA a => USegd -> UArr a -> USegd -> UArr a -> UArr a | | foldlSU :: (UA a, UA b) => (b -> a -> b) -> b -> USegd -> UArr a -> UArr b | | foldSU :: UA a => (a -> a -> a) -> a -> USegd -> UArr a -> UArr a | | fold1SU :: UA a => (a -> a -> a) -> USegd -> UArr a -> UArr a | | foldlRU :: (UA a, UA b) => (b -> a -> b) -> b -> Int -> Int -> UArr a -> UArr b | | andSU :: USegd -> UArr Bool -> UArr Bool | | orSU :: USegd -> UArr Bool -> UArr Bool | | sumSU :: (Num e, UA e) => USegd -> UArr e -> UArr e | | productSU :: (Num e, UA e) => USegd -> UArr e -> UArr e | | maximumSU :: (Ord e, UA e) => USegd -> UArr e -> UArr e | | minimumSU :: (Ord e, UA e) => USegd -> UArr e -> UArr e | | sumRU :: (Num e, UA e) => Int -> Int -> UArr e -> UArr e | | lengthUSegd :: USegd -> Int | | lengthsUSegd :: USegd -> UArr Int | | indicesUSegd :: USegd -> UArr Int | | elementsUSegd :: USegd -> Int | | lengthsToUSegd :: UArr Int -> USegd | | mkUSegd :: UArr Int -> UArr Int -> Int -> USegd | | newU :: UA e => Int -> (forall s. MUArr e s -> ST s ()) -> UArr e | | permuteMU :: UA e => MUArr e s -> UArr e -> UArr Int -> ST s () | | atomicUpdateMU :: UA e => MUArr e s -> UArr (Int :*: e) -> ST s () | | unsafeFreezeAllMU :: UA e => MUArr e s -> ST s (UArr e) | | idstr :: [Char] | | name :: [Char] | | versnum :: [Char] | | date :: [Char] | | version :: [Char] | | copyright :: [Char] | | disclaimer :: [Char] | | lengthU' :: UA e => UArr e -> Int |
|
|
|
Array classes
|
|
|
Basic operations on representation types
-----------------------------------------
This type class determines the types that can be elements immutable
unboxed arrays. The representation type of these arrays is defined by way
of an associated type. All representation-dependent functions are methods
of this class.
| | Associated Types | | | Methods | | Yield the length of an unboxed array
| | | Restrict access to a subrange of the original array (no copying)
| | | Allocate a mutable unboxed array
| | | Indicate whether the type supports atomic updates
| | | Copy the contents of an immutable unboxed array into a mutable one
from the specified position on
|
| | Instances | |
|
|
Array types
|
|
|
Segment descriptors represent the structure of nested arrays. For each
segment, it stores the length and the starting index in the flat data
array.
| Instances | |
|
|
Basic operations
|
|
|
Test whether the given array is empty
|
|
|
Yield an empty array
|
|
|
Yield a singleton array
|
|
|
Prepend an element to an array
|
|
|
Basic operations on unboxed arrays
-----------------------------------
Yield an array of units
|
|
|
Yield an array where all elements contain the same value
|
|
|
Array indexing
|
|
|
Concatenate two arrays
|
|
|
Indexing
---------
Associate each element of the array with its index
|
|
|
Repeat an array n times
|
|
Subarrays
|
|
|
|
|
Yield the tail of an array
|
|
|
Extract a prefix of an array
|
|
|
Extract a suffix of an array
|
|
|
Split an array into two halves at the given index
|
|
Permutations
|
|
|
Standard permutation
|
|
|
|
|
Back permutation operation (ie, the permutation vector determines for each
position in the result array its origin in the input array)
WARNING: DO NOT rewrite this as unstreamU . bpermuteUS es . streamU
because GHC won't be able to figure out its strictness.
|
|
|
:: UA e | | => Int | length of result array
| -> Int -> e | initialiser function
| -> UArr (Int :*: e) | index-value pairs
| -> UArr e | | Default back permute
- The values of the index-value pairs are written into the position in the
result array that is indicated by the corresponding index.
- All positions not covered by the index-value pairs will have the value
determined by the initialiser function for that index position.
|
|
|
|
Reverse the order of elements in an array
|
|
|
Yield an array constructed by updating the first array by the
associations from the second array (which contains index/value pairs).
|
|
Higher-order operations
|
|
|
Map a function over an array
|
|
|
|
|
|
|
Extract all elements from an array that meet the given predicate
|
|
|
Extract all elements from an array according to a given flag array
|
|
|
Array reduction proceeding from the left
|
|
|
Array reduction proceeding from the left for non-empty arrays
FIXME: Rewrite for Streams.
|
|
|
|
|
Array reduction that requires an associative combination function with its
unit
|
|
|
Reduction of a non-empty array which requires an associative combination
function
|
|
|
|
|
Prefix scan proceedings from left to right
|
|
|
Prefix scan of a non-empty array proceeding from left to right
|
|
|
Prefix scan proceeding from left to right that needs an associative
combination function with its unit
|
|
|
Prefix scan of a non-empty array proceeding from left to right that needs
an associative combination function
|
|
|
|
|
Accumulating map from left to right. Does not return the accumulator.
FIXME: Naming inconsistent with lists.
|
|
|
|
|
Merge two segmented arrays according to flag array
|
|
Searching
|
|
|
Determine whether the given element is in an array
|
|
|
Negation of elemU
|
|
Logical operations
|
|
|
|
|
|
|
|
|
|
Arithmetic operations
|
|
|
Compute the sum of an array of numerals
|
|
|
Compute the product of an array of numerals
|
|
|
Determine the maximum element in an array
|
|
|
Determine the minimum element in an array
|
|
|
Determine the maximum element in an array under the given ordering
|
|
|
Determine the minimum element in an array under the given ordering
|
|
|
Determine the index of the maximum element in an array
|
|
|
Determine the index of the minimum element in an array
|
|
|
Determine the index of the maximum element in an array under the given
ordering
|
|
|
Determine the index of the minimum element in an array under the given
ordering
|
|
Arrays of pairs
|
|
|
Elementwise pairing of array elements.
|
|
|
|
|
Elementwise unpairing of array elements.
|
|
|
|
|
Yield the first components of an array of pairs.
|
|
|
Yield the second components of an array of pairs.
|
|
Enumerations
|
|
|
Yield an enumerated array
FIXME: See comments about enumFromThenToS
|
|
|
Yield an enumerated array using a specific step
FIXME: See comments about enumFromThenToS
|
|
|
|
|
|
|
|
Searching
|
|
|
|
|
|
Conversions to/from lists
|
|
|
Conversion
-----------
Turn a list into a parallel array
|
|
|
Collect the elements of a parallel array in a list
|
|
Unlifted.Sequential arrays
|
|
|
|
|
|
I/O
|
|
|
| Methods | | | Instances | |
|
|
Basic operations (segmented)
|
|
|
|
|
|
|
|
Higher-order operations (segmented)
|
|
|
Segmented array reduction proceeding from the left
|
|
|
Segmented array reduction that requires an associative combination
function with its unit
|
|
|
Segmented array reduction with non-empty subarrays and an associative
combination function
|
|
Higher-order operations (regular)
|
|
|
Regular arrar reduction
|
|
Logical operations (segmented)
|
|
|
|
|
|
Arithmetic operations (segmented)
|
|
|
Compute the segmented sum of an array of numerals
|
|
|
Compute the segmented product of an array of numerals
|
|
|
Determine the maximum element in each subarray
|
|
|
Determine the minimum element in each subarray
|
|
Arithmetic operations (regular segmented)
|
|
|
Compute the segmented sum of an array of numerals
|
|
Segment descriptors
|
|
|
Operations on segment descriptors
----------------------------------
Yield the overall number of segments
|
|
|
Yield the segment lengths of a segment descriptor
|
|
|
Yield the segment indices of a segment descriptor
|
|
|
Yield the number of data elements
|
|
|
Convert a length array into a segment descriptor.
|
|
|
|
Mutable arrays
|
|
|
Creating unboxed arrays
------------------------
|
|
|
Permutations
-------------
|
|
|
|
|
|
Library id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FIXME: A fuseable version of lengthU, should go away
|
|
Produced by Haddock version 2.6.1 |